• File: hub_import_maintain_1.php
  • Full Path: C:/htdocs/REEFTintegrationLog_test/REEFTintegrationLog/saved/hub_import_maintain_1.php
  • Date Modified: 04/30/2025 7:56 AM
  • File size: 35.44 KB
  • MIME-type: text/x-php
  • Charset: utf-8
<?php
//======================================================================================
//
// Function: Maintain department
//
// Programmer: JKJ
// Date      : 2024-04-02
//
// Copyright Reeft A/S (c) - 2024
//======================================================================================

//======================================================================================
// General config
//======================================================================================
	include "config/config.php";
	

//======================================================================================
// Check if user is logged in?
//======================================================================================
	include "login_check.php";

//======================================================================================
// Get session variables
//======================================================================================

	include "include/getsession.php";


	// include "include/uuid_create.php";
	// include "include/generate_password_md5.php";

//======================================================================================
// Set language
//======================================================================================

	include "include/set_language.php";

//======================================================================================
// Set defaults
//======================================================================================

	// $pk_reference  = $_SESSION['session_dft_pk_reference'];
	// $referenceCode = $_SESSION['session_dft_referencecode'];
	// $referenceName = $_SESSION['session_dft_referencename'];

//======================================================================================
?>
<!DOCTYPE html>
<html lang="en">
<head>
	<title><?php echo $datahub_text0001 ?></title>

	<meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
	<meta name="description" content="REEFTvisual - Stoptime">
    <meta name="author" content="REEFT A/S">
    <link rel="icon" href="images/favicon/favicon.ico">

    <!-- Bootstrap / jQuery -->
    <link href="css/bootstrap4.3.1/css/bootstrap.custom.min.css" rel="stylesheet">
    <link href="css/bootstrap4.3.1/css/themes/bootstrap.custom.min.css" rel="stylesheet">

	<link href="css/bootstrap4.3.1/css/normalize.css" rel="stylesheet" type="text/css">

	<link href="css/sticky-footer.css" rel="stylesheet" type="text/css">

    <!-- Custom styles for this template -->
    <link href="css/custom.css" rel="stylesheet">
    <link href="css/style.css" rel="stylesheet">


	<script src="css/fontawesome6.5.1/js/all.min.js"></script>
	<script src="css/fontawesome6.5.1/js/sharp-light.min.js"></script>
	<script src="css/fontawesome6.5.1/js/sharp-regular.min.js"></script>
	<script src="css/fontawesome6.5.1/js/sharp-solid.min.js"></script>
	<script src="css/fontawesome6.5.1/js/sharp-thin.min.js"></script>
	

	<link href="css/bootstrap_animation/css/animate4/animate.css" rel="stylesheet" type="text/css">

	<!--<link href="javascript/chosen/chosen.css" rel="stylesheet" type="text/css">-->

	<link href="javascript/jquery-ui/jquery-ui.min.css" rel="stylesheet" type="text/css"/>

    <script src="javascript/jquery.js"></script>
    <script src="css/bootstrap4.3.1/js/popper.js"></script>
    <script src="css/bootstrap4.3.1/js/bootstrap.min.js"></script>

	<script src="javascript/jquery-ui/jquery-ui.min.js"></script>
    <script src="javascript/jquery.ui.touch-punch.min.js"></script>

	<script src="javascript/moment.min.js"></script>
	<script src="javascript/moment-with-locales.min.js"></script>
	<script src="javascript/moment-duration-format.min.js"></script>

	<script src="javascript/number_format/jquery.number.min.js"></script>

	<script src="javascript/jquery.scrollTo.min.js"></script>


	<link href="javascript/daatatables/media/css/jquery.dataTables.min.css" rel="stylesheet" type="text/css">
	<link href="javascript/daatatables/media/css/fixedHeader.dataTables.min.css" rel="stylesheet" type="text/css">
	<link href="javascript/daatatables/Buttons-1.4.2/css/buttons.dataTables.min.css" rel="stylesheet" type="text/css">

    <script src="javascript/daatatables/media/js/jquery.dataTables.min.js"></script>
    <script src="javascript/daatatables/media/js/dataTables.fixedHeader.min.js"></script>
	<script src="javascript/daatatables/Buttons-1.4.2/js/dataTables.buttons.min.js"></script>
	<script src="javascript/daatatables/Buttons-1.4.2/js/buttons.flash.min.js"></script>
	<script src="javascript/daatatables/JSZip-2.5.0/jszip.min.js"></script>
	<script src="javascript/daatatables/pdfmake-0.1.53/pdfmake.min.js"></script>
	<script src="javascript/daatatables/pdfmake-0.1.53/vfs_fonts.js"></script>
	<script src="javascript/daatatables/Buttons-1.4.2/js/buttons.html5.min.js"></script>
	<script src="javascript/daatatables/Buttons-1.4.2/js/buttons.print.min.js"></script>

	<script src="javascript/chosen/chosen.jquery.min.js" type="text/javascript"></script>

	<script src="javascript/viewer-master/dist/viewer.min.js"></script>
	<link  href="javascript/viewer-master/dist/viewer.min.css" rel="stylesheet">

	<script src="javascript/ajaxq/ajaxq.js"></script>

	<link id="scrollUpTheme" rel="stylesheet" href="javascript/scrollup-master/dist/css/themes/image.css">
	<script src="javascript/scrollup-master/dist/jquery.scrollUp.js"></script>
	<script src="javascript/shortcut.js"></script>

	<script src="javascript/_reeft_js/set_font_awesome_icon_type.js"></script>
	<script src="javascript/_reeft_js/date_convert.js"></script>
<style>

.btn-custom-wide {
	height:60px;
	width:210px;
}


.border-3 {
    border-width:3px !important;
}

td .hover-img {
  position:relative;
 }
td .hover-img span {
  position:absolute; left:-9999px; top:-9999px; z-index:9999;
 }
td:hover .hover-img span {
  top: 5px;
  left:0px;
 }

 .chosen-container-single {
    min-width: 100%;
}

</style>

<script language="JavaScript">

//=============================================================================
// Globals
//=============================================================================

	var jsonDataSave = {};
	//var DFT_MAX_NUMBER_TYPES = <?php //echo $DFT_MAX_NUMBER_TYPES ?>;

	var DFT_DATE_DISPLAY_FORMAT =  '<?php //echo $DFT_DATE_DISPLAY_FORMAT ?>';
	var DFT_LANGUAGE 			=  '<?php //echo $DFT_LANGUAGE ?>';


	// Save field
	var save_IPFILENAME = '';


	$(function () {
	  $.scrollUp({
		scrollName: 'scrollUp', // Element ID
		//topDistance: '1800', // Distance from top before showing element (px)
		//topSpeed: 300, // Speed back to top (ms)
		scrollDistance: '300', // Distance from top before showing element (px)
		scrollSpeed: 300, // Speed back to top (ms)
		animation: 'fade', // Fade, slide, none
		animationInSpeed: 200, // Animation in speed (ms)
		animationOutSpeed: 200, // Animation out speed (ms)
		scrollText: false, //'Scroll to top', // Text for element
		activeOverlay: false, // Set CSS color to display scrollUp active point, e.g '#00FFFF'
	  });
	});

//=============================================================================
// Get data
//=============================================================================
function getData()
{


	//$('#data-result').html('<?php echo $datahub_text0003 ?>').addClass('text-center');


	// Create param list
	parmData = '';
			 ;


	$.ajax({
		url: "hub_import_maintain_get.php",
		type: "GET",
		data: parmData,
		dataType: "json",
		cache: false,
	beforeSend: function( xhr ) {

	}
	})
	.done(function( jsonData ) {

				// Save jSon data
				jsonDataSave = jsonData;

				var returnCode 		= jsonData.header.returnCode;
				var returnMsg 		= jsonData.header.returnMsg;
				var entries_found 	= jsonData.header.entries_found;
				var response_sec 	= jsonData.header.response_sec;


				// Show load time
				$('#load-time-from-database').html('entries found: ' + entries_found + ' (' + response_sec + ')');

				// Reset
				HTMLline02 = '<table id="REEFTvisual_data" class="table table-bordered table-striped table-hover">';

				HTMLline02 +=	'<thead>'
				           + 	'<tr class="bg-primary text-white font-weight-bold text-center">'
						   +	'<th class="text-left">'
						   +	'<?php echo $datahub_text0003 ?>'
						   +	'</th>'
						   +	'<th class="text-left">'
						   +	'<?php echo $datahub_text0004 ?>'
						   +	'</th>'
						   +	'<th class="text-center">'
						   +	'<?php echo $datahub_text0006 ?>'
						   +	'</th>'
						   +	'<th class="text-center">'
						   +	'<button id="add-button" title="Shortcut: Alt+F6" onclick="dataAdd(\'' + '0' + '\')" class="btn btn-dark font-weight-bold">' + '<?php echo $datahub_button_save_01 ?>' + '</button>'
						   +	'</th>'
						   +	'</tr>'
						   +	'</thead>'
						   +	'<tbody>'
						   ;

				$.each( jsonData.detail, function( index, object ){


					var IPACTIV				= object.IPACTIV;
					var IPFILENAME			= object.IPFILENAME;
					var IPIMPSEQ			= object.IPIMPSEQ;
					var IPFILENMWK			= object.IPFILENMWK;
					var IPLIBRNAME			= object.IPLIBRNAME;
					var IPFILEDESC			= object.IPFILEDESC;
					var IPIFSNAME			= object.IPIFSNAME;
					var IPIFSDESC			= object.IPIFSDESC;
					var IPCPYOPT			= object.IPCPYOPT;
					var IPCPYMAIN			= object.IPCLRMAIN;
					var IPCLRMAIN			= object.IPCPYMAIN;
					var IPRUNSQL			= object.IPRUNSQL;
					var IPSQLWHR			= object.IPSQLWHR;
					var IPSQLSMT			= object.IPSQLSMT;
					var IPRUNPGM			= object.IPRUNPGM;
					var IPPGMWHR			= object.IPPGMWHR;
					var IPPGMSMT			= object.IPPGMSMT;

					if ( IPACTIV == 'Y' ) {
						var IPACTIV_text = '<div class="text-success font-weight-bold"><?php echo $datahub_YES ?></div>';
					} else {
						var IPACTIV_text = '<div class="text-danger font-weight-bold"><?php echo $datahub_NO ?></div>';
					}

					// Show deleted
					var show_deleted = $('#input-show-deleted').val();
					if ( show_deleted == 'Y' )
					{
						var recordOK = 'Y';

					} else {

						if ( IPACTIV == 'N' )
						{
							var recordOK = 'Y';
						} else {
							var recordOK = 'N';
						}

					}

					// Show record
					if ( recordOK == 'Y' )
					{

					HTMLline02 +=	'<tr>'
							   +	'<td class="text-left">'
							   +	IPFILENAME
							   +	'</td>'
							   +	'<td class="text-left">'
							   +    IPFILEDESC
							   +	'</td>'
							   +	'<td class="text-center">'
							   +    '<span title="Field value=' + IPACTIV + '">' + IPACTIV_text + '</span>'
							   +	'</td>'
							   +	'<td>'
							   +	'<button id="' + IPFILENAME + '" onclick="dataChange(\'' + IPFILENAME + '\')" class="btn btn-primary">' + '<?php echo $datahub_button_edit ?>' + '</button>'
							   +	'</td>'
							   +	'</tr>'
							   ;

					}

				});


				HTMLline02  +=	'</tbody>'
				            +	'</table>'


				// Show yourself to the world, you little fvcker
				$('#data-result').html(HTMLline02);

				// Datatables
				setDataTables();

				//-----------------------------------------------------------------------
				// Set font awesome icon type
				//-----------------------------------------------------------------------
					// Value is from config/config.php
					var iconType = '<?php echo $DFT_SET_FONT_AWESOME_ICON_TYPE ?>';
					setFontAwesomeIconType( iconType );
				//-----------------------------------------------------------------------



	})
	.always(function( xml ) {

		//console.log('I am always..');


	})
	.fail(function( xhr, ajaxOptions, thrownError ) {
		console.log('I am failed..');
		console.log( xhr );

	});

}

//=============================================================================
// Set datatables
//=============================================================================
function setDataTables()
{

    $('#REEFTvisual_data').DataTable({
        "responsive": true,
		"fixedHeader": true,
		"lengthMenu": [[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]],
		"iDisplayLength": 25,
        "processing": true,
		"dom": 'lfi<bottom>Bp<"clear">',
        "order": [[ 0, "asc" ]],
		"columnDefs": [
				{
				"targets": [ 3 ],
				"visible": true,
				"searchable": false,
				 "orderable": false
				}

		],
		"language":
		{

					"sProcessing":   "<?php echo $datahub_datatable_Processing ?>",
					"sLengthMenu":   "<?php echo $datahub_datatable_LengthMenu ?>",
					"sZeroRecords":  "<?php echo $datahub_datatable_ZeroRecords ?>",
					"sInfo":         "<?php echo $datahub_datatable_Info ?>",
					"sInfoEmpty":    "<?php echo $datahub_datatable_InfoEmpty ?>",
					"sInfoFiltered": "<?php echo $datahub_datatable_InfoFiltered ?>",
					"sInfoPostFix":  "<?php echo $datahub_datatable_InfoPostFix ?>",
					"sLoadingRecords": "<?php echo $datahub_datatable_Processing ?>",
					"sSearch":       "<?php echo $datahub_datatable_Search ?>",
					"sUrl":          "<?php echo $datahub_datatable_Url ?>",
					"oPaginate": {
						"sFirst":    "<?php echo $datahub_datatable_First ?>",
						"sPrevious": "<?php echo $datahub_datatable_Previous ?>",
						"sNext":     "<?php echo $datahub_datatable_Next ?>",
						"sLast":     "<?php echo $datahub_datatable_Last ?>"
					}
		},
        "rowCallback": function(row, data, index)
		{



		},
        "preDrawCallback": function(settings)
		{
		},
		"initComplete": function ()
		{

		},
		"buttons": 	[
					{
						extend: 'pdf',
						text: '<img src="images/pdf_logo.png" height="25"> PDF',
						orientation: 'landscape',
						exportOptions: {
						modifier: {
							page: 'all'
							}
						}
					},
					{
						extend: 'excel',
						text: '<img src="images/microsoft_excel_logo.png" height="25"> Excel'
						},
						{
						extend: 'copy',
						text: '<img src="images/copy.png" height="25"> Copy to Clipboard'
						},
					]
    });


}

//=============================================================================
// Reason addd
//=============================================================================
function dataAdd ( input_pk_type )
{

			$('#input-mode').val('*add');

			$('#modal-input-IPFILENAME').val('');
			$('#modal-input-IPIMPSEQ').val(10);
			$('#modal-input-IPFILENMWK').val('');
			$('#modal-input-IPLIBRNAME').val('');
			$('#modal-input-IPFILEDESC').val('');
			$('#modal-input-IPIFSNAME').val('');
			$('#modal-input-IPIFSDESC').val('');
			$('#modal-input-IPCPYOPT').val('');
			$('#modal-input-IPCPYMAIN').val('');
			$('#modal-input-IPCLRMAIN').val('');
			$('#modal-input-IPRUNSQL').val('');
			$('#modal-input-IPSQLWHR').val('');
			$('#modal-input-IPSQLSMT').val('');
			$('#modal-input-IPRUNPGM').val('');
			$('#modal-input-IPPGMWHR').val('');
			$('#modal-input-IPPGMSMT').val('');
			$('#modal-input-IPACTIV').val('Y');


			// $('#modal-input-IPFILEDESC').val( '' );
			// $('#modal-input-IPIMPSEQ').val( '' );

			// Hidden fields
			// $('#modal-input-IPFILENAME').val( 0 );
			// $('#modal-input-IPFILENMWK').val( '' );
			// $('#modal-input-IPLIBRNAME').val( '' );
			// $('#modal-input-IPACTIV').val( '1' );

			// Reset save field
			save_IPFILENAME = '';

			// Set active - default YES
			$('#button-deleted-yes').removeClass('btn-primary').addClass('btn-success');
			$('#button-deleted-no').removeClass('btn-danger').addClass('btn-primary');


			// Reset modal message
			resetModalMessage();

			// Show modal
			$('#departmentMaintainModal').modal('show');

			$('#departmentMaintainModal').on('shown.bs.modal', function () {
				$('#modal-input-IPFILEDESC').trigger('focus');
			})

}

//=============================================================================
// Reason change
//=============================================================================
function dataChange( input_IPFILENAME )
{

	$('#input-mode').val('*update');

	// Find the correct data
	$.each( jsonDataSave.detail, function( index, object ){

		// var IPFILENAME			= object.IPFILENAME;
		// var IPFILEDESC			= object.IPFILEDESC;
		// var IPIMPSEQ			= object.IPIMPSEQ;
		// var IPFILENMWK		= object.IPFILENMWK;
		// var IPLIBRNAME		= object.IPLIBRNAME;
		// var IPACTIV		= object.IPACTIV;

		var IPACTIV				= object.IPACTIV;
		var IPFILENAME			= object.IPFILENAME;
		var IPIMPSEQ			= object.IPIMPSEQ;
		var IPFILENMWK			= object.IPFILENMWK;
		var IPLIBRNAME			= object.IPLIBRNAME;
		var IPFILEDESC			= object.IPFILEDESC;
		var IPIFSNAME			= object.IPIFSNAME;
		var IPIFSDESC			= object.IPIFSDESC;
		var IPCPYOPT			= object.IPCPYOPT;
		var IPCPYMAIN			= object.IPCLRMAIN;
		var IPCLRMAIN			= object.IPCPYMAIN;
		var IPRUNSQL			= object.IPRUNSQL;
		var IPSQLWHR			= object.IPSQLWHR;
		var IPSQLSMT			= object.IPSQLSMT;
		var IPRUNPGM			= object.IPRUNPGM;
		var IPPGMWHR			= object.IPPGMWHR;
		var IPPGMSMT			= object.IPPGMSMT;


		// Data found
		if ( input_IPFILENAME == IPFILENAME ) {

			$('#modal-input-IPFILENAME').val( IPFILENAME );
			$('#modal-input-IPIMPSEQ').val( IPIMPSEQ );
			$('#modal-input-IPFILENMWK').val( IPFILENMWK );
			$('#modal-input-IPLIBRNAME').val( IPLIBRNAME );
			$('#modal-input-IPFILEDESC').val( IPFILEDESC );
			$('#modal-input-IPIFSNAME').val( IPIFSNAME );
			$('#modal-input-IPIFSDESC').val( IPIFSDESC );
			$('#modal-input-IPCPYOPT').val( IPCPYOPT );
			$('#modal-input-IPCPYMAIN').val( IPCLRMAIN );
			$('#modal-input-IPCLRMAIN').val( IPCPYMAIN );
			$('#modal-input-IPRUNSQL').val( IPRUNSQL );
			$('#modal-input-IPSQLWHR').val( IPSQLWHR );
			$('#modal-input-IPSQLSMT').val( IPSQLSMT );
			$('#modal-input-IPRUNPGM').val( IPRUNPGM );
			$('#modal-input-IPPGMWHR').val( IPPGMWHR );
			$('#modal-input-IPPGMSMT').val( IPPGMSMT );

			// Save orginal department code
			save_IPFILENAME = IPFILENAME;

			// Check active code
			if ( IPACTIV != 'Y' && IPACTIV != 'N' ) {
				IPACTIV = 'Y';
			}

			$('#modal-input-IPACTIV').val( IPACTIV );

			// Set active - default YES
			if ( IPACTIV == 'Y' ) {
				$('#button-deleted-yes').removeClass('btn-primary').addClass('btn-success');
				$('#button-deleted-no').removeClass('btn-danger').addClass('btn-primary');
			} else {
				$('#button-deleted-no').removeClass('btn-primary').addClass('btn-danger');
				$('#button-deleted-yes').removeClass('btn-success').addClass('btn-primary');

			}

		}

	})

	// Reset modal message
	resetModalMessage();

	// Show modal
	$('#departmentMaintainModal').modal('show');

	$('#departmentMaintainModal').on('shown.bs.modal', function () {
		$('#modal-input-IPFILEDESC').trigger('focus');
	})


}

//=============================================================================
// Toggle Delete Reason
//=============================================================================
function toggleDelete()
{

			$('#icon-modal-input-active').removeClass('text-success text-danger');

			var active = $('#modal-input-active').val();

			// active?
			if ( active == '1' ) {
				$('#modal-input-active').val( '0' );
				$('#icon-modal-input-active').html('<i class="far fa-2x fa-check-square"></i>').addClass('text-danger');
			} else {
				$('#modal-input-active').val( '1' );
				$('#icon-modal-input-active').html('<i class="far fa-2x fa-square"></i>');
			}

}


//=============================================================================
// Save reference
//=============================================================================
function dataSave()
{
	// Reset modal message
	resetModalMessage();


	// Check content of fields
	if ( $('#modal-input-IPFILEDESC').val() == '' ) {
		//$('#modal-message').addClass('mt-2 p-2 font-weight-bold border border-danger rounded bg-light').html( '<?php echo $datahub_error0033 ?>' );

		$('#modal-message').addClass(' border-bottom').html( '<?php echo $datahub_error0033 ?>' );
		$('#modal-save-button').addClass('disabled').prop("disabled", true);
		$('#modal-input-IPFILEDESC').focus();
		return false;
	}

	if ( $('#modal-input-IPIMPSEQ').val() == '' ) {
		//$('#modal-message').addClass('p-2 font-weight-bold border border-danger rounded bg-light').html( '<?php echo $datahub_error0034 ?>' );

		$('#modal-message').addClass(' border-bottom').html( '<?php echo $datahub_error0034 ?>' );
		$('#modal-save-button').addClass('disabled').prop("disabled", true);
		$('#modal-input-IPIMPSEQ').focus();
		return false;
	}

	var mode = $('#input-mode').val();

	var data = $('#dataForm').find('input, select').serializeArray();
	var result = JSON.stringify(data);

	// console.log(data);
	// console.log(result);
	// return;

	var parmData = 'data=' + result
				 + '&mode=' + mode
				 ;

	$.ajax({
		url: "hub_import_maintain_save.php",
		type: "POST",
		data: parmData,
		dataType: "json",
		cache: false,
	})
	.done(function( jsonData ) {

		
		$('#departmentMaintainModal').modal('hide');
		getData();

	})
	.always(function( jsonData ) {

	})
	.fail(function( xhr, ajaxOptions, thrownError ) {
		console.log('I am failed..');
		console.log( xhr );

	});

}

//=============================================================================
// Check if userid exists
//=============================================================================
function checkDataExists()
{

	var IPFILENAME = $('#modal-input-IPFILENAME').val();

	// If update, then the "orginal" code is ok
	if ( $('#input-mode').val() == '*update' ) {
		if ( IPFILENAME == save_IPFILENAME ) {
			return;
		}
	}

	var parmData = 'IPFILENAME=' + IPFILENAME
				 ;

	$.ajax({
		url: "department_check_if_exist.php",
		type: "GET",
		data: parmData,
		dataType: "json",
		cache: false,
	})
	.done(function( jsonData ) {

		var returnCode 		= jsonData.header.returnCode;
		var returnMsg 		= jsonData.header.returnMsg;
		var entries_found 	= jsonData.header.entries_found;


		if ( returnCode == '00') {
			//$('#modal-message').addClass('mt-2 p-2 font-weight-bold border border-danger rounded bg-light').html( '<?php echo $datahub_error0032 ?>' );
			$('#modal-message').addClass(' border-bottom').html( '<?php echo $datahub_error0032 ?>' );
			$('#modal-save-button').addClass('disabled').prop("disabled", true);
			$('#modal-input-IPFILENAME').focus();
			return false;
		}

		// Reset modal message
		resetModalMessage();

	})
	.always(function( jsonData ) {

	})
	.fail(function( xhr, ajaxOptions, thrownError ) {
		console.log('I am failed..');
		console.log( xhr );

	});

}

//=============================================================================
// Set Active Button (Yes/No)
//=============================================================================
function setActiveButton( activeMode )
{

	if ( activeMode == 'Y' ) {
		$('#button-deleted-yes').removeClass('btn-primary').addClass('btn-success');
		$('#button-deleted-no').removeClass('btn-danger').addClass('btn-primary');
	} else {
		$('#button-deleted-yes').removeClass('btn-success').addClass('btn-primary');
		$('#button-deleted-no').removeClass('btn-primary').addClass('btn-danger');
	}

	$('#modal-input-IPACTIV').val(activeMode );
}

//=============================================================================
// Show deleted
//=============================================================================
function showDeleted()
{

	var show_deleted = $('#input-show-deleted').val();


	if ( show_deleted == 'Y' ) {
		$('#button-show-deleted').html('<?php echo $datahub_NO ?>');
		$('#input-show-deleted').val('N');
	} else {
		$('#button-show-deleted').html('<?php echo $datahub_YES ?>');
		$('#input-show-deleted').val('Y');
	}

	getData();

}

//=============================================================================
// Log off
//=============================================================================
function signoff()
{

	window.location.href = "logout.php";

}

//=============================================================================
// Load page
//=============================================================================
function loadPage(url, p1, p2, p3)
{

	window.location.href = url;

}

//=============================================================================
// Set clock
//=============================================================================
function updateClock() {

	var currentTime = moment().format('YYYY-MM-DD HH:mm:ss');
	currentTime = REEFT_format_date( currentTime, DFT_DATE_DISPLAY_FORMAT )

	$('#current-time').html( currentTime );

}

//=============================================================================
// Reset modal message
//=============================================================================
function resetModalMessage() {

	// Reset
	//$('#modal-message').removeClass('p-2 font-weight-bold border border-danger rounded bg-light').html( '&nbsp;' );

	$('#modal-message').removeClass('border-bottom').html( '&nbsp;' );
	$('#modal-save-button').removeClass('disabled').prop("disabled", false);

}


//=============================================================================
// jQuery - Ready
//=============================================================================
$(document).ready(function()
{

	// Do not show deleted
	$('#input-show-deleted').val('Y');

	// Get data
	getData();

	//-----------------------------------------------------------------------
	// Start the clock
	//-----------------------------------------------------------------------
		updateClock();
		setInterval(function() {
			updateClock();
		}, 1000); 
	//-----------------------------------------------------------------------
	

	//-----------------------------------------------------------------------
	// Set font awesome icon type
	//-----------------------------------------------------------------------
		// Value is from config/config.php
		var iconType = '<?php echo $DFT_SET_FONT_AWESOME_ICON_TYPE ?>';
		setFontAwesomeIconType( iconType );
	//-----------------------------------------------------------------------


	//-----------------------------------------------------------------------
	// Set short cuts
	//-----------------------------------------------------------------------
	shortcut.add("Alt+F6",function() {
		$('#add-button').click();
	});

	// Toggle show deleted
	shortcut.add("Alt+F2",function() {
		$('#button-toggle-show-deleted').click();
	});



});
// -->
</script>

</head>

<body>

<div class="container-fluid mt-2 pl-3 pr-3">

		<input type="text" id="input-mode" class="d-none">
		<input type="text" id="input-show-deleted" class="d-none">


		<div class="row">
			<div class="col-2">
				<img src="images/customer-logo.png" alt="Customer Logo">
			</div>
			<div class="col-8 text-center <?php echo $DFT_CLOCK_SIZE ?>">
				<i class="font-awesome-pseudo-class fa-thin fa-clock"></i>&nbsp;&nbsp;<span id="current-time"><?php echo date('d-m-Y h:i:s') ?></span>
			</div>
			<div class="col-2 text-right">
				<div class="btn btn-primary mb-1" onclick="loadPage('menu_admin.php','','','')" title="<?php echo $datahub_go_to_my_dear_home ?>"><i class="font-awesome-pseudo-class fa-2x fa-thin fa-home"></i></div>
				<div class="btn btn-primary mb-1 d-none d-xl-inline-block" onclick="loadPage('menu_main.php','','','')" title="<?php echo $datahub_go_to_my_dear_home_03 ?>"><i class="font-awesome-pseudo-class fa-2x fa-thin fa-fort"></i></div>
				<div class="btn btn-danger mb-1 d-none d-lg-inline-block"  onclick="signoff()" title="<?php echo $datahub_go_to_my_dear_home_04 ?>"><i class="font-awesome-pseudo-class fa-thin  fa-2x fa-right-from-bracket"></i></div>


			</div>
		</div>

		<div class="card mt-2">

			<div class="card-header text-muted">
				<div class="row mt-2">
					<div class="col-4 h4">
						<i class="font-awesome-pseudo-class fa-thin fa-store"></i> <?php echo "$datahub_text0005"; ?>
					</div>
					<div class="col text-right font-weight-bold">
						<button type="button" class="btn btn-dark" id="button-toggle-show-deleted" title="Alt+F2=Toggle" onclick="showDeleted()"><?php echo $datahub_button_show_also_deleted ?> : <span id="button-show-deleted" class="font-weight-bold"><?php echo $datahub_YES ?></span></button>
					</div>
				</div>
			</div>

			<div class="card-body">


				<div class="row">
					<div class="col">
						<div id="data-result"></div>
					</div>
				</div>

				<div class="row">
					<div class="col text-right">
						<small><div id="load-time-from-database"></div></small>
					</div>
				</div>

			</div>

		</div>


</div>


<!-- Set footer -->
<?php
	include "include/footer.php";
?>
<!-- Set footer -->

<!-- ========================================================================== -->
<!--                                M O D A L S                                 -->
<!-- ========================================================================== -->

<!-- Modal -->
<div class="modal fade" id="departmentMaintainModal" tabindex="-1" data-backdrop="static" role="dialog" aria-labelledby="departmentMaintainModalLabel" aria-hidden="true">
  <div class="modal-dialog modal-xl">
    <div class="modal-content">
      <div class="modal-header bg-primary text-white">
        <h5 class="modal-title" id="departmentMaintainModalLabel"><i class="font-awesome-pseudo-class fa-thin fa-store"></i> <?php echo $datahub_text0005 ?></h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">

			<form name="dataForm" id="dataForm">


			<div class="row mt-2">
				<div class="col-5">
					<?php echo $datahub_text0003 ?>
				</div>
				<div class="col-4">
					<input class="form-control" type="text" onkeyup="checkDataExists()" id="modal-input-IPFILENAME" name="modal-input-IPFILENAME">
				</div>
			</div>
			
			<div class="row mt-2">
				<div class="col-5">
					<?php echo $datahub_text0006 ?>
				</div>
				<div class="col-6">
					<button type="button" class="btn btn-primary" onclick="setActiveButton('Y')" id="button-deleted-yes"><?php echo $datahub_YES ?></button>
					<button type="button" class="btn btn-primary" onclick="setActiveButton('N')" id="button-deleted-no"><?php echo $datahub_NO ?></button>
					<input class="d-none form-control" type="text" onkeyup="resetModalMessage()" id="modal-input-IPACTIV" name="modal-input-IPACTIV">
				</div>
			</div>

			<div class="row mt-2">
				<div class="col-5">
					<?php echo $datahub_text0007 ?>
				</div>
				<div class="col-3">
					<input class="form-control" type="number" step="10" id="modal-input-IPIMPSEQ" name="modal-input-IPIMPSEQ" onkeyup="resetModalMessage()">
				</div>
			</div>

			<div class="row mt-2">
				<div class="col-5">
					<?php echo $datahub_text0008 ?>
				</div>
				<div class="col-4">
					<input class="form-control" type="text" id="modal-input-IPFILENMWK" name="modal-input-IPFILENMWK" onkeyup="resetModalMessage()">
				</div>
			</div>

			<div class="row mt-2">
				<div class="col-5">
					<?php echo $datahub_text0009 ?>
				</div>
				<div class="col-4">
					<input class="form-control" type="text" id="modal-input-IPLIBRNAME" name="modal-input-IPLIBRNAME" onkeyup="resetModalMessage()">
				</div>
			</div>

			<div class="row mt-2">
				<div class="col-5">
					<?php echo $datahub_text0010 ?>
				</div>
				<div class="col-6">
					<input class="form-control" type="text" id="modal-input-IPFILEDESC" name="modal-input-IPFILEDESC" onkeyup="resetModalMessage()">
				</div>
			</div>

			<div class="row mt-2">
				<div class="col-5">
					<?php echo $datahub_text0011 ?>
				</div>
				<div class="col-6">
					<input class="form-control" type="text" id="modal-input-IPIFSNAME" name="modal-input-IPIFSNAME" onkeyup="resetModalMessage()">
				</div>
			</div>

			<div class="row mt-2">
				<div class="col-5">
					<?php echo $datahub_text0012 ?>
				</div>
				<div class="col-6">
					<input class="form-control" type="text" id="modal-input-IPIFSDESC" name="modal-input-IPIFSDESC" onkeyup="resetModalMessage()">
				</div>
			</div>

			<div class="row mt-2">
				<div class="col-5">
					<?php echo $datahub_text0013 ?>
				</div>
				<div class="col-2">
					<input class="form-control" type="text" id="modal-input-IPCPYOPT" name="modal-input-IPCPYOPT" onkeyup="resetModalMessage()">
				</div>
			</div>

			<div class="row mt-2">
				<div class="col-5">
					<?php echo $datahub_text0014 ?>
				</div>
				<div class="col-2">
					<input class="form-control" type="text" id="modal-input-IPCPYMAIN" name="modal-input-IPCPYMAIN" onkeyup="resetModalMessage()">
				</div>
			</div>

			<div class="row mt-2">
				<div class="col-5">
					<?php echo $datahub_text0015 ?>
				</div>
				<div class="col-2">
					<input class="form-control" type="text" id="modal-input-IPCLRMAIN" name="modal-input-IPCLRMAIN" onkeyup="resetModalMessage()">
				</div>
			</div>

			<div class="row mt-2">
				<div class="col-5">
					<?php echo $datahub_text0016 ?>
				</div>
				<div class="col-2">
					<input class="form-control" type="text" id="modal-input-IPRUNSQL" name="modal-input-IPRUNSQL" onkeyup="resetModalMessage()">
				</div>
			</div>

			<div class="row mt-2">
				<div class="col-5">
					<?php echo $datahub_text0017 ?>
				</div>
				<div class="col-2">
					<input class="form-control" type="text" id="modal-input-IPSQLWHR" name="modal-input-IPSQLWHR" onkeyup="resetModalMessage()">
				</div>
			</div>

			<div class="row mt-2">
				<div class="col-5">
					<?php echo $datahub_text0018 ?>
				</div>
				<div class="col-6">
					<input class="form-control" type="text" id="modal-input-IPSQLSMT" name="modal-input-IPSQLSMT" onkeyup="resetModalMessage()">
				</div>
			</div>

			<div class="row mt-2">
				<div class="col-5">
					<?php echo $datahub_text0019 ?>
				</div>
				<div class="col-2">
					<input class="form-control" type="text" id="modal-input-IPRUNPGM" name="modal-input-IPRUNPGM" onkeyup="resetModalMessage()">
				</div>
			</div>

			<div class="row mt-2">
				<div class="col-5">
					<?php echo $datahub_text0020 ?>
				</div>
				<div class="col-2">
					<input class="form-control" type="text" id="modal-input-IPPGMWHR" name="modal-input-IPPGMWHR" onkeyup="resetModalMessage()">
				</div>
			</div>

			<div class="row mt-2">
				<div class="col-5">
					<?php echo $datahub_text0021 ?>
				</div>
				<div class="col-6">
					<input class="form-control" type="text" id="modal-input-IPPGMSMT" name="modal-input-IPPGMSMT" onkeyup="resetModalMessage()">
				</div>
			</div>

			</form>

      </div>
      <div class="modal-footer-pretty modal-footer">

			<div class="container-fluid">

				<div class="row">
					<div class="col-12 text-left">
						<div class="p-1 font-weight-bold text-danger border-top border-dark " id="modal-message">&nbsp;</div>
					</div>
				</div>


			<div class="row mt-1 mb-2">
					<div class="col-3 text-left">
						<button type="button" id="modal-save-button" class="btn btn-primary btn-block" onclick="dataSave()"><?php echo $datahub_button_save ?></button>
					</div>
					<div class="col-6 text-right">
					</div>
					<div class="col-3 text-right">
						<button type="button" class="btn btn-primary btn-block" data-dismiss="modal"><?php echo $datahub_button_cancel ?></button>
					</div>
				</div>
			</div>


      </div>
    </div>
  </div>
</div>

</body>
</html>